home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1992 July / Nautilus-3-8 / Nautilus-3-8.bin / Tools & Utilities / Techy Stuff / Doco ƒ / CSMP ƒ / CSMP-V1-053.TXT < prev    next >
Encoding:
Text File  |  1992-06-03  |  43.2 KB  |  1,197 lines

  1. C.S.M.P. Digest             Sat, 18 Apr 92       Volume 1 : Issue 53
  2.  
  3. Today's Topics:
  4.  
  5.     C.S.M.P. Digest Mailing List * Call For Votes *
  6.     where is alpha?
  7.     Think C Debugger...pain in my a$$....
  8.     Fast Event Handling During Calculations (How?)
  9.     AppleLink <-> internet ?
  10.     enum in Think C
  11.     Printer Info Stored Where?
  12.     Problem with FSpExchangeFiles
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. These digests are available (by using FTP, account anonymous, your email
  18. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  19. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  20. Questions list.  The last several issues of the digest are available from
  21. sumex-aim.stanford.edu as well.
  22.  
  23. These digests are also available via email.  Just send a note saying that you
  24. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  25. automatically receive each new digest as it is created.
  26.  
  27. The articles in these digests are taken directly from comp.sys.mac.programmer.
  28. They are not edited; all articles included in this digest are in their original
  29. posted form.  The only articles that are -not- included in these digests are
  30. those which didn't receive any replies (except those that give information
  31. rather than ask a question).  All replies to each article are concatenated
  32. onto the original article in the order in which they were received.  Article
  33. threads are not added to the digests until the last article added to the
  34. thread is at least one month old (this is to ensure that the thread is dead
  35. before adding it to the digests).
  36.  
  37. Send administrative mail to mkelly@cs.uoregon.edu.
  38.  
  39. -------------------------------------------------------
  40.  
  41. From: mkelly@majestix.cs.uoregon.edu (Michael A. Kelly)
  42. Subject: C.S.M.P. Digest Mailing List * Call For Votes *
  43. Organization: University of Oregon Computer and Information Sciences Dept.
  44. Date: Mon, 9 Mar 1992 02:06:02 GMT
  45.  
  46.  
  47. >From:    "Corp. Reed" <ecr2@midway.uchicago.edu>
  48. >
  49. >Would it be possible to get a Comp.sys.mac.programmer digest mailing list
  50. >going?  Some people are still unblessed by the wonders of ftp and news, 
  51. >and this would probably be doing them a big favor.
  52. >
  53. >-Corp Reed
  54.  
  55. It certainly could be done.  What do you all think?
  56.  
  57. Mike.
  58. - -- 
  59. _____________________________________________________________________________
  60. Michael A. Kelly                                         University of Oregon
  61. mkelly@cs.uoregon.edu                             Computer Science Department
  62. _____________________________________________________________________________
  63.  
  64. +++++++++++++++++++++++++++
  65.  
  66. From: rat@po.CWRU.Edu (Reza A. Tabib-Azar)
  67. Date: 9 Mar 92 04:47:54 GMT
  68. Organization: Case Western Reserve University, Cleveland, OH (USA)
  69.  
  70.  
  71. In a previous article, mkelly@majestix.cs.uoregon.edu (Michael A. Kelly) says:
  72.  
  73. >
  74. >>From:    "Corp. Reed" <ecr2@midway.uchicago.edu>
  75. >>
  76. >>Would it be possible to get a Comp.sys.mac.programmer digest mailing list
  77. >>going?  Some people are still unblessed by the wonders of ftp and news, 
  78. >>and this would probably be doing them a big favor.
  79. >>
  80. >>-Corp Reed
  81. >
  82. >It certainly could be done.  What do you all think?
  83. >
  84. >Mike.
  85. >-- 
  86. >_____________________________________________________________________________
  87. >Michael A. Kelly                                         University of Oregon
  88. >mkelly@cs.uoregon.edu                             Computer Science Department
  89. >_____________________________________________________________________________
  90. >
  91. Agreed, it would be very nice.
  92.  
  93. Reza A. Tabib-Azar
  94. EBME CWRU
  95.  
  96. +++++++++++++++++++++++++++
  97.  
  98. From: edw@caligula.uucp (Edwin Howell Watkeys III)
  99. Date: 9 Mar 92 04:43:39 GMT
  100. Organization: Drexel University (Comp Sci) / Distant Software
  101.  
  102.  
  103. In article <1992Mar9.020602.24020@cs.uoregon.edu> (comp.sys.mac.programmer), mkelly@majestix.cs.uoregon.edu (Michael A. Kelly) writes:
  104. > >From:    "Corp. Reed" <ecr2@midway.uchicago.edu>
  105. > >
  106. > >Would it be possible to get a Comp.sys.mac.programmer digest mailing list
  107. > >going?  Some people are still unblessed by the wonders of ftp and news, 
  108. > >and this would probably be doing them a big favor.
  109. > >
  110. > >-Corp Reed
  111. > It certainly could be done.  What do you all think?
  112. > Mike.
  113.  
  114. I get news, but I think it would be nice to get a "noise-free" distillation
  115. of comp.sys.mac.programmer... In other words, "yes."
  116.  
  117. Ed
  118.  
  119. - ---------
  120. Ed Watkeys                         "...the peace symbol is actually an an-
  121. phlpa!caligula!edw@cs.widener.edu   cient Druidic symbol which means 'de-
  122. Programmer, Athiest, Cynic          feat Christianity.'" -- P. Hoefflinger
  123. Distant Software/Drexel University  ------CYNICAL QUOTE OF THE WEEK-------
  124.  
  125. +++++++++++++++++++++++++++
  126.  
  127. From: rf27+@andrew.cmu.edu (Robert Bruce Findler)
  128. Date: 9 Mar 92 17:50:04 GMT
  129. Organization: Freshman, MCS general, Carnegie Mellon, Pittsburgh, PA
  130.  
  131. Good idea. I would like to be on the list.
  132.  
  133. .................................................................
  134. :    rf27+@andrew.cmu.edu    : The fan awaits the shit, Madame. :
  135. : rfindler@oasys.dt.navy.mil : Moliere's, _The Misanthrope_     :
  136. :............................:...............................ECFO
  137.  
  138. +++++++++++++++++++++++++++
  139.  
  140. From: calvin@leland.Stanford.EDU (The Weasel)
  141. Organization: DSG, Stanford University, CA 94305, USA
  142. Date: Wed, 11 Mar 92 06:41:05 GMT
  143.  
  144. Count me as an aye vote.
  145.  
  146. Peter
  147.  
  148. +++++++++++++++++++++++++++
  149.  
  150. From: Carl.Constantine@BCSystems.GOV.BC.CA
  151. Date: 10 Mar 92 15:43:20 GMT
  152. Organization: BC Systems Corporation
  153.  
  154. In article <1992Mar9.020602.24020@cs.uoregon.edu>, mkelly@majestix.cs.uoregon.edu (Michael A. Kelly) writes:
  155. >>From:    "Corp. Reed" <ecr2@midway.uchicago.edu>
  156. >>
  157. >>Would it be possible to get a Comp.sys.mac.programmer digest mailing list
  158. >>going?  Some people are still unblessed by the wonders of ftp and news, 
  159. >>and this would probably be doing them a big favor.
  160. >>
  161. >>-Corp Reed
  162. > It certainly could be done.  What do you all think?
  163.  
  164. I like it and would like each digest e-mailed to me!!!! I like I like I
  165. like!!!!
  166.  
  167. address below
  168. - -- 
  169. Carl.Constantine@BCSystems.gov.bc.ca
  170. Victoria, British Columbia, Canada
  171.  
  172. +++++++++++++++++++++++++++
  173.  
  174. From: peterc@moebius.cubetech.com (Peter Creath)
  175. Date: Wed, 11 Mar 92 20:00:39 CST
  176. Organization: Cube Technologies
  177.  
  178. I vote for a mailing list...
  179.  
  180. - ----------------------------------------------------------------------------
  181. Peter Creath                 "When I was a boy I was told that anybody could
  182. peterc@moebius.cubetech.com   become president; I'm beginning to believe it."
  183.                                                            -- Clarence Darrow
  184.  
  185. +++++++++++++++++++++++++++
  186.  
  187. From: aep@world.std.com (Andrew E Page)
  188. Organization: The World Public Access UNIX, Brookline, MA
  189. Date: Mon, 16 Mar 1992 18:07:38 GMT
  190.  
  191.   I VOTE YES.  and I would probably set asside a separate area on my
  192. hard disk for the digest, and a macro key in White Knight to download
  193. it from my mail once it dropped in.  
  194.  
  195.  
  196. - -- 
  197. Andrew E. Page CTO(Warrior Poet)|   Decision and Effort The Archer and Arrow
  198. DSP Ironworks                   |     The difference between what we are
  199. Macintosh and DSP Technology    |           and what we want to be.
  200.  
  201. +++++++++++++++++++++++++++
  202.  
  203. From: kpmiller@uokmax.ecn.uoknor.edu (Kent P Miller)
  204. Organization: Engineering Computer Network, University of Oklahoma, Norman, OK
  205. Date: Tue, 17 Mar 1992 17:42:44 GMT
  206.  
  207. In article <BL7x0r.7Ks@world.std.com> aep@world.std.com (Andrew E Page) writes:
  208. >  I VOTE YES.  and I would probably set asside a separate area on my
  209. >hard disk for the digest, and a macro key in White Knight to download
  210. >it from my mail once it dropped in.  
  211. >
  212.  
  213. At the risk of flooding someone's ftp site - somebody is keeping a digest 
  214. already and has been for a while.  If everyone would like to take a look,
  215. they are for anonymous ftp from
  216.  
  217. skinner.cs.uoregon.edu
  218.  
  219. in the directory (I think) pub/mac/csmp-digest.  From what I can tell, the 
  220. person compiling them is doing a very good job.  He's done about 20 issues
  221. so far.
  222. - -- 
  223. - -----------------------
  224. Kent Miller
  225. kpmiller@uokmax.ecn.uoknor.edu
  226. - -----------------------
  227.  
  228. ---------------------------
  229.  
  230. From: jcasella@magnus.acs.ohio-state.edu (Joseph A Casella)
  231. Subject: where is alpha?
  232. Organization: The Ohio State University
  233. Date: Mon, 16 Mar 1992 13:48:18 GMT
  234.  
  235.  
  236. I recently downloaded a copy of harvest c, and the author recommended
  237. that a shareware text editor called "alpha" be used with it.
  238.  
  239. I checket the major ftp sites (sumex, rascal, umich) and have been 
  240. unable to find a copy of alpha or anything else that looked like a
  241. text editor.  Can anybody tell me where I can find "alpha" or 
  242. something like it?
  243.  
  244.  
  245. +++++++++++++++++++++++++++
  246.  
  247. From: e-sink@uiuc.edu (Eric W. Sink)
  248. Organization: University of Illinois at Urbana-Champaign
  249. Date: Mon, 16 Mar 1992 15:29:34 GMT
  250.  
  251. In <1992Mar16.134818.15730@magnus.acs.ohio-state.edu> jcasella@magnus.acs.ohio-state.edu (Joseph A Casella) writes:
  252.  
  253. >I recently downloaded a copy of harvest c, and the author recommended
  254. >that a shareware text editor called "alpha" be used with it.
  255.  
  256. >I checket the major ftp sites (sumex, rascal, umich) and have been 
  257. >unable to find a copy of alpha or anything else that looked like a
  258. >text editor.  Can anybody tell me where I can find "alpha" or 
  259. >something like it?
  260. [there is nothing like Alpha]
  261.  
  262. Look again.  Behold, mac.archive.umich.edu :
  263.  
  264. ftp> pwd
  265. 257 "/mac/utilities/editors" is current directory.
  266.  
  267. ftp> dir
  268. 200 PORT command successful.
  269. 150 Opening data connection for /bin/ls (129.229.1.100,2270) (0 bytes).
  270. total 1211
  271. drwxrwxr-x  2 20020    staff        2048 Dec 31 15:40 .AppleDouble
  272. - -rw-rw-r--  1 20062    staff      272420 Oct 26 20:25 alpha4.01.cpt.hqx
  273.                                                       ^^^^^^^^^^^^^^^^^
  274. If you have a DeskWriter or StyleWriter, the current version of Alpha
  275. won't print for you.  Mail to pete@rice.edu and he will mercifully
  276. help you.
  277.  
  278. Caveat: what version of Harvest C did you get ?  I assume you got version
  279. 1.1, or more accurately 1.1b2.  If you just want to see the compiler to
  280. take a look at it, look at that one, but it's pretty buggy still.  The
  281. new version is much better, really.  Look on harvest.cecer.army.mil,
  282. in pub/mac/harvestc/pretest.hqx.  This is version 1.2d1.  It's not even
  283. alpha-test quality yet, but I'd speculate it might be more stable than
  284. 1.1b2.  I'm currently doing pre-alpha testing, and will start alpha test
  285. asap.  I hope to have a 1.2 final by June 17 at the latest.  Anyway, if
  286. you want to really use the compiler, you'll save yourself some frustration
  287. if you wait a little bit...
  288.  
  289. - -- 
  290. Eric W. Sink,  Spatial Analysis and Systems Team
  291. USACERL, P.O. Box 9005, Champaign, IL 61826-9005
  292. 1-800-USA-CERL x449,   e-sink@uiuc.edu
  293.  
  294. ---------------------------
  295.  
  296. From: ian@umiami.ir.miami.edu
  297. Subject: Think C Debugger...pain in my a$$....
  298. Date: 12 Mar 92 00:17:16 EST
  299. Organization: Univ of Miami IR
  300.  
  301. Grrrrrr....
  302.  
  303. I just spent all f***ing day trying to find out why I couldn't use
  304. the debugger from TC5.0.2 on my project (it kept saying "out of memory")
  305. so after rewriting some utilities to remove ANSI and then a whole host of other
  306. things..on a whim I coppied my files from the file server to the local hard
  307. drive....bam...it works fine.....OH CHRIST!!!!! 
  308. Well I'm calm now but I thought appleshare was supposed to be transparent...
  309. Ahh well I guess someone did something funky somewhere...
  310. Peace...
  311. - -- 
  312. Ian Sullivan
  313. *******************************************************************************
  314. **ian@umbio.med.miami.edu      %   "Friendly Fire"..There is no such thing   **
  315. **ian@umiami.ir.miami.edu      %    Remember your gun was made by the        **
  316. **ian@umiami.bitnet            %    lowest bidder.                           **
  317. **ian@impala.ir.miami.edu      %   "A question to god...                     **
  318. **                             %       Jason Gross....why?"-a poem           **
  319. **UUU    UMUMMM     MMMMMM     %                                             **
  320. **UUU    UMU MMM   MMM MMM     %   "Skate to Kill--Kill to Skate"            **
  321. **uUU    UMU  MMM MMM  MMM     %   "Life's been good to me so far..." -J.W.  **
  322. **UUUUUUUUMUof MMMMM   MMM     %   "Give it a while." -Me.                   **
  323. *******************************************************************************
  324. Yes..yes...I know I spelled it wrong......whatever it was. ;)
  325.  
  326. +++++++++++++++++++++++++++
  327.  
  328. From: zobkiw@world.std.com (Joe Zobkiw)
  329. Date: 13 Mar 92 17:29:19 GMT
  330. Organization: The World Public Access UNIX, Brookline, MA
  331.  
  332. Um...just a suggestion...don't ever run any files from a file server...
  333. especially if you're programming! What if the server crashed? You might go
  334. with it!
  335.  
  336.  
  337. - -- 
  338. <--------------------------------------------------->
  339.  joe zobkiw                     zobkiw@world.std.com
  340.  mac.synthesis.MIDI.development.C.asm.communications
  341. >---------------------------------------------------<
  342.  
  343. +++++++++++++++++++++++++++
  344.  
  345. From: rfischer@Xenon.Stanford.EDU (Ray Fischer)
  346. Organization: Computer Science Department, Stanford University.
  347. Date: Sun, 15 Mar 1992 00:07:53 GMT
  348.  
  349. ian@umiami.ir.miami.edu writes ...
  350. >I just spent all f***ing day trying to find out why I couldn't use
  351. >the debugger from TC5.0.2 on my project (it kept saying "out of memory")
  352. >so after rewriting some utilities to remove ANSI and then a whole host of other
  353. >things..on a whim I coppied my files from the file server to the local hard
  354. >drive....bam...it works fine.....OH CHRIST!!!!! 
  355.  
  356. An easier solution would have been to reduce the memory partition for
  357. the application or Think C, or turn on virtual memory.  I'll agree
  358. that the message in unnecessarily cryptic, but it _is_ explained
  359. in the manual.  You get the message when Think C + Debugger + Application
  360. is greater than the amount of free memory.
  361.  
  362. >Well I'm calm now but I thought appleshare was supposed to be transparent...
  363.  
  364. But it does use up memory.
  365.  
  366. Ray
  367. rfischer@cs.stanford.edu
  368.  
  369. +++++++++++++++++++++++++++
  370.  
  371. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  372. Organization: Symantec Corp.
  373. Date: Sun, 15 Mar 1992 14:03:32 GMT
  374.  
  375. >>>>> On Sun, 15 Mar 1992 00:07:53 GMT, rfischer@Xenon.Stanford.EDU (Ray Fischer) said:
  376.  
  377.  > ian@umiami.ir.miami.edu writes ...
  378. >>Well I'm calm now but I thought appleshare was supposed to be
  379. >>transparent...
  380.  
  381.  > But it does use up memory.
  382.  
  383. The problem that Ian was running into doesn't have anything to do with
  384. memory. If you try to use the THINK C debugger when the THINK C app
  385. and the Debugger are on an AppleShare server, you'll get an "Out of
  386. Memory" error when THINK C tries to lauch the debugger. THINK C 5.0 is
  387. not intended to run off of an AppleShare server; this may be changed
  388. in a future release, but for now that's the way it is.
  389.  
  390.     -phil
  391. - --
  392.    Phil Shapiro                                   Software Engineer
  393.    Language Products Group                     Symantec Corporation
  394.            Internet: phils@cs.brandeis.edu
  395.  
  396. +++++++++++++++++++++++++++
  397.  
  398. From: minich@a.cs.okstate.edu (Robert Minich)
  399. Date: 15 Mar 92 22:43:01 GMT
  400. Organization: Oklahoma State University
  401.  
  402. by phils@chaos.cs.brandeis.edu (Phil Shapiro):
  403. > The problem that Ian was running into doesn't have anything to do with
  404. > memory. If you try to use the THINK C debugger when the THINK C app
  405. > and the Debugger are on an AppleShare server, you'll get an "Out of
  406. > Memory" error when THINK C tries to lauch the debugger. THINK C 5.0 is
  407. > not intended to run off of an AppleShare server; this may be changed
  408. > in a future release, but for now that's the way it is.
  409.  
  410. What on earth does ThC do that breaks it on a file server?
  411.  
  412. - -- 
  413. Robert Minich
  414. minich@a.cs.okstate.edu   |Godwin's Rule of Nazi Analogies: As a Usenet dis-
  415. Oklahoma State University |cussion grows longer, the probability of a com-
  416. Bill 'n Opus for '92      |parison involving Nazis or Hitler approaches one.
  417.  
  418. +++++++++++++++++++++++++++
  419.  
  420. From: stevep@wrq.com (Steve Poole)
  421. Organization: Walker Richer & Quinn
  422. Date: Mon, 16 Mar 1992 20:25:41 GMT
  423.  
  424. In article <PHILS.92Mar15090332@chaos.cs.brandeis.edu>, phils@chaos.cs.brandeis.edu (Phil Shapiro) writes:
  425. > The problem that Ian was running into doesn't have anything to do with
  426. > memory. If you try to use the THINK C debugger when the THINK C app
  427. > and the Debugger are on an AppleShare server, you'll get an "Out of
  428. > Memory" error when THINK C tries to lauch the debugger. THINK C 5.0 is
  429. > not intended to run off of an AppleShare server; this may be changed
  430. > in a future release, but for now that's the way it is.
  431.  
  432. Hmm.  I'm running into the same thing.  However, my ThC stuff is
  433. local, the project is on the server, and I have over 10M free for
  434. the debugger and debugged app (together wanting 600K + 512K).  If
  435. I turn off Use Debugger it runs, otherwise "out of memory" pops up.
  436. Didn't happen until I put it on the server, and if I move the
  437. project local again it's OK.  This is 5.0.2.  Any ideas?
  438.  
  439. - --------------------------------------------------------------------------
  440. - -- INTEL 80x86: Just say NOP -- Internet: stevep@wrq.com -- AOL: Spoole -- 
  441. - --------------------------------------------------------------------------
  442.  
  443.  
  444.  
  445. +++++++++++++++++++++++++++
  446.  
  447. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  448. Organization: Symantec Corp.
  449. Date: Tue, 17 Mar 1992 14:43:07 GMT
  450.  
  451. >>>>> On 16 Mar 92 20:25:41 GMT, stevep@wrq.com (Steve Poole) said:
  452.  > In article <PHILS.92Mar15090332@chaos.cs.brandeis.edu>, phils@chaos.cs.brandeis.edu (Phil Shapiro) writes:
  453.  
  454. >> The problem that Ian was running into doesn't have anything to do
  455. >> with memory. If you try to use the THINK C debugger when the THINK
  456. >> C app and the Debugger are on an AppleShare server, you'll get an
  457. >> "Out of Memory" error when THINK C tries to lauch the debugger.
  458.  
  459.  > Hmm.  I'm running into the same thing.  However, my ThC stuff is
  460.  > local, the project is on the server, and I have over 10M free for
  461.  > the debugger and debugged app (together wanting 600K + 512K).  If I
  462.  > turn off Use Debugger it runs, otherwise "out of memory" pops up.
  463.  
  464. As it turns out, THINK C uses the same technique to "launch" your
  465. project as it does to launch the debugger. It kind of fools the OS
  466. into thinking that your project is temporarily a launchable
  467. application. So, the two errors are caused by the same problem.
  468.  
  469. The "Out Of Memory" error is probably just the OS error that we happen
  470. to get back from _Launch. I have no idea how this part of THINK C
  471. works, so I don't really know why it doesn't work correctly.
  472.  
  473.     -phil
  474. - --
  475.    Phil Shapiro                                   Software Engineer
  476.    Language Products Group                     Symantec Corporation
  477.            Internet: phils@cs.brandeis.edu
  478.  
  479. +++++++++++++++++++++++++++
  480.  
  481. From: newlin@woodling.ecn.purdue.edu (Captain Kludge)
  482. Organization: Purdue University Engineering Computer Network
  483. Date: 17 Mar 92 16:14:30 GMT
  484.  
  485.  
  486.  
  487.  
  488. >In article <PHILS.92Mar15090332@chaos.cs.brandeis.edu>, phils@chaos.cs.brandeis.edu (Phil Shapiro) writes:
  489. >> 
  490. >> The problem that Ian was running into doesn't have anything to do with
  491. >> memory. If you try to use the THINK C debugger when the THINK C app
  492. >> and the Debugger are on an AppleShare server, you'll get an "Out of
  493. >> Memory" error when THINK C tries to lauch the debugger. THINK C 5.0 is
  494. >> not intended to run off of an AppleShare server; this may be changed
  495. >> in a future release, but for now that's the way it is.
  496.  
  497. >Hmm.  I'm running into the same thing.  However, my ThC stuff is
  498. >local, the project is on the server, and I have over 10M free for
  499. >the debugger and debugged app (together wanting 600K + 512K).  If
  500. >I turn off Use Debugger it runs, otherwise "out of memory" pops up.
  501. >Didn't happen until I put it on the server, and if I move the
  502. >project local again it's OK.  This is 5.0.2.  Any ideas?
  503.  
  504.  
  505. Yes,
  506.   The problem is that the project has to be local.  The application
  507.   and debugger can be on a server, I have done this and it works fine.
  508.   This is 5.0.2 also.
  509.  
  510. - -John
  511.  
  512.  
  513. ---------------------------
  514.  
  515. From: rla20@duts.ccc.amdahl.com (Roger Allen)
  516. Subject: Fast Event Handling During Calculations (How?)
  517. Date: 12 Mar 92 18:45:25 GMT
  518. Organization: Amdahl Corporation, Sunnyvale CA
  519.  
  520. What is the best way to do some sort of calculation that will take some
  521. time WITHOUT making the calculation time much longer due to adding code
  522. do deal with the following.
  523.   1) get events (like clicking a 'Cancel' button).
  524.   2) allow your program to be put into the background.
  525.   3) allow other programs to receive events.
  526.  
  527. I have some calculations that I must do and I want to please both the
  528. people who want fast calculation time and also the people who want to
  529. run it in the background and do word processing or something else.
  530.  
  531. Psuedocode:
  532.    bring up progress dialog box
  533.    while not done do {
  534.      do calculation and store value
  535.      update dialog box
  536.      if event (HELP this takes alot of time!)
  537.        do event
  538.    }
  539.    bring down progress dialog box
  540.  
  541. I've tried a few things for the "if event" part and all slow down
  542. my code ALOT.  I'm doing about 20K calculations or more. (all floating pt)
  543. Calculation time goes from ~10sec to ~20sec with event handling.
  544.  
  545. Any help is appreciated.
  546.  
  547. Roger.
  548. - --
  549. > Roger Allen                   |  All the opinions expressed are my     <
  550. > Amdahl Computer Development   |  own and are not Amdahl's.             <
  551. > rla20@cd.amdahl.com           |  ------They paid me to say that------- <
  552.  
  553. +++++++++++++++++++++++++++
  554.  
  555. From: sgrenander@NASAMAIL.JPL.NASA.GOV (Sven Grenander)
  556. Organization: Jet Propulsion Laboratory
  557. Date: Thu, 12 Mar 1992 21:24:20 GMT
  558.  
  559. In article <16rR02FT0dVj01@JUTS.ccc.amdahl.com>, rla20@duts.ccc.amdahl.com (Roger Allen) writes:
  560. > What is the best way to do some sort of calculation that will take some
  561. > time WITHOUT making the calculation time much longer due to adding code
  562. > ....
  563.  
  564.  
  565. The way I handle this is either of the following (depending on
  566. how long the operation is likely to take):
  567.  
  568. If it is a long operation which does not have to be finished
  569. right away (write multi-meg files with sorting interspersed, or
  570. some such thing) I simply post a chore (ThC CChore) to trigger
  571. X executions every time through the event loop.
  572.  
  573. If it is a higher priority, shorter duration activity I simply
  574. put an EventAvail in the tight loops. If the EventAvail == TRUE
  575. I save my current loop variables, post a chore to re-enter
  576. the loop, exit out to the main event loop and pick back up
  577. where I was in the loop when the chore fires again.
  578.  
  579. This second method works very well for me, actually both do.
  580. However, the second one lets me accept a 19.2 Kb serial feed,
  581. with rather messy parsing, window updating and Object creation,
  582. disposal etc while not impacting word processing, MacDrawing
  583. or whatever. At least I can't type fast enough to outrun my fx.
  584.  
  585. Good luck.
  586.  
  587. - -Sven
  588.  
  589.  
  590. +++++++++++++++++++++++++++
  591.  
  592. From: berry@a.chem.upenn.edu (Don Berry)
  593. Date: 12 Mar 92 22:27:47 GMT
  594. Organization: University of Pennsylvania
  595.  
  596. In article <16rR02FT0dVj01@JUTS.ccc.amdahl.com>, rla20@duts.ccc.amdahl.com 
  597.     (Roger Allen) writes:
  598. > What is the best way to do some sort of calculation that will take some
  599. > time WITHOUT making the calculation time much longer due to adding code
  600. > do deal with the following.
  601. >   1) get events (like clicking a 'Cancel' button).
  602. >   2) allow your program to be put into the background.
  603. >   3) allow other programs to receive events.
  604.  
  605. Although I suppose it's not that graceful, I just handle events on
  606. every nth pass through the calculation loop, where n can be adjusted
  607. to meet your performance objectives. For example, in a routine that
  608. reads text lines, parses, and writes the result, I check for events
  609. every 50-100 lines and it seems to be reasonably well behaved in background.
  610.  (Oh yeah, WaitTicks = 20L).
  611.  
  612. modification of Roger's pseudo-code:
  613.  
  614.    while not done do {
  615.      do calculation and store value
  616.      update dialog box
  617.      if (i%100 == 0)
  618.        check for event and deal with it
  619.      i++;
  620.    }
  621.  
  622. I'd be delighted in any of you serious programmers out there would
  623. (a) comment on the potential evils of this method and (b) suggest
  624. more elegant methods.
  625.  
  626. Don Berry
  627. Department of Chemistry
  628. University of Pennsylvania
  629.  
  630.  
  631.  
  632. +++++++++++++++++++++++++++
  633.  
  634. From: swofford@uxh.cso.uiuc.edu (David Swofford )
  635. Organization: University of Illinois at Urbana
  636. Date: Thu, 12 Mar 1992 22:48:06 GMT
  637.  
  638. sgrenander@NASAMAIL.JPL.NASA.GOV (Sven Grenander) writes:
  639.  
  640. >In article <16rR02FT0dVj01@JUTS.ccc.amdahl.com>, rla20@duts.ccc.amdahl.com (Roger Allen) writes:
  641. >> 
  642. >> What is the best way to do some sort of calculation that will take some
  643. >> time WITHOUT making the calculation time much longer due to adding code
  644. >> ....
  645.  
  646. >The way I handle this is either of the following (depending on
  647. >how long the operation is likely to take):
  648.  
  649. >If it is a long operation which does not have to be finished
  650. >right away (write multi-meg files with sorting interspersed, or
  651. >some such thing) I simply post a chore (ThC CChore) to trigger
  652. >X executions every time through the event loop.
  653.  
  654. >If it is a higher priority, shorter duration activity I simply
  655. >put an EventAvail in the tight loops. If the EventAvail == TRUE
  656. >I save my current loop variables, post a chore to re-enter
  657. >the loop, exit out to the main event loop and pick back up
  658. >where I was in the loop when the chore fires again.
  659.  
  660. >This second method works very well for me, actually both do.
  661. >However, the second one lets me accept a 19.2 Kb serial feed,
  662. >with rather messy parsing, window updating and Object creation,
  663. >disposal etc while not impacting word processing, MacDrawing
  664. >or whatever. At least I can't type fast enough to outrun my fx.
  665.  
  666. This may have missed the point of the original poster's question 
  667. (apologies to Sven if I'm wrong).  My application also does
  668. heavy-duty computation for long periods, but I want to watch for 
  669. update, suspend/resume, etc. events (and most importantly, command-period
  670. keyboard events).  I suspect the original poster had the same thing
  671. in mind.  Calling GetNextEvent or WaitNextEvent from computation loops 
  672. can REALLY slow things down a lot.  I used to call EventAvail 
  673. (actually OSEventAvail, which is even faster) and didn't call 
  674. Get/WaitNextEvent unless I knew there was an event to deal with.  
  675. But this approach didn't work well with MultiFinder, so I decided
  676. on the following:
  677.  
  678. If you're in the FOREGROUND, call Get/WaitNextEvent only twice a second
  679. or so.  I just keep a 'lastEventCheckTime' after every such call and
  680. do an "if (Ticks - lastEventCheckTime > 30)" test before checking for
  681. events and processing them.  The worst that can happen is that there
  682. will be a slight delay (no more than 1/2 a second) after a user
  683. hits a command-period key (or whatever) until the event gets handled.
  684. I find that event-checking has little impact on the speed of the
  685. calculations as long as you limit it to this rate.  But if you're in
  686. the BACKGROUND, it's crucial to call GetNextEvent or (preferably)
  687. WaitNextEvent much more often, so that you won't slow the foreground
  688. application to a crawl (It doesn't do any good to allow background
  689. calculations if you impose a 1/2 sec delay on every keystroke on the
  690. foreground app). 
  691. - --
  692. David L. Swofford                 Phone:    (217)244-6959
  693. Illinois Natural History Survey   FAX:      (217)333-4949
  694. 607 E. Peabody Drive              BITNET:   DAVESWOF@UIUCVMD
  695. Champaign, Illinois 61820 USA     Internet: swofford@uxh.cso.uiuc.edu
  696.  
  697. +++++++++++++++++++++++++++
  698.  
  699. From: d88-jwa@byse.nada.kth.se (Jon W{tte)
  700. Date: 13 Mar 92 16:45:44 GMT
  701. Organization: Royal Institute of Technology, Stockholm, Sweden
  702.  
  703. .com> rla20@duts.ccc.amdahl.com (Roger Allen) writes:
  704.  
  705.    Psuedocode:
  706.       bring up progress dialog box
  707.       while not done do {
  708.     do calculation and store value
  709.     update dialog box
  710.     if event (HELP this takes alot of time!)
  711.       do event
  712.       }
  713.       bring down progress dialog box
  714.  
  715. You could do one of the following:
  716.  
  717.     cnt = 0 ;
  718.     bring up progress dialog
  719.     while not done do {
  720.         calculate
  721.         if ( inBackground || ! ( cnt++ & 0xf ) ) {
  722.             updateprogress
  723.             eventhandling
  724.         }
  725.     }
  726.  
  727. Note: inBackground is changed by eventhandling according to
  728. suspend/resume events.
  729.  
  730. eventhandling should pass 0 to WaitNextEvent, and probably a
  731. NULL mouseRgn. The beauty of this is that the user who wants
  732. to get the result will look at the progess bas in the foreground,
  733. and only gets his event every 16 passes, while the backgrounding
  734. user will get good background time (you should pass 10 for the
  735. waitnextevent time in the background, and 0 in the foreground) 
  736.  
  737. You could be tempted to change the !(cnt++&0xf) part to something
  738. like TickCount()>nextTime, but that gives a trap dispatch while
  739. in te foreground... DO NOT USE "Ticks" AS IT'S UNAVAILABLE UNDER A/UX
  740. and also may very well be optimized away by your compiler.
  741. Code like:
  742.  
  743.     while ( Ticks < contTime ) ;
  744.  
  745. Has been known to hang, because the compiler regards Ticks as a
  746. variable that does not change inside the loop...
  747.  
  748. - -- 
  749. This signature is placed into the Public Domain by Jon W{tte (h+@nada.kth.se)
  750.                      - The worlds only romantic cynic -
  751.  
  752. +++++++++++++++++++++++++++
  753.  
  754. From: stevec@Apple.COM (Steve Christensen)
  755. Date: 14 Mar 92 04:49:06 GMT
  756. Organization: Apple Computer Inc., Cupertino, CA
  757.  
  758. rla20@duts.ccc.amdahl.com (Roger Allen) writes:
  759.  
  760. >What is the best way to do some sort of calculation that will take some
  761. >time WITHOUT making the calculation time much longer due to adding code
  762. >do deal with [events and letting other programs have time]
  763.  
  764. >I have some calculations that I must do and I want to please both the
  765. >people who want fast calculation time and also the people who want to
  766. >run it in the background and do word processing or something else.
  767.  
  768. >Psuedocode:
  769. >   bring up progress dialog box
  770. >   while not done do {
  771. >     do calculation and store value
  772. >     update dialog box
  773. >     if event (HELP this takes alot of time!)
  774. >       do event
  775. >   }
  776. >   bring down progress dialog box
  777.  
  778. >I've tried a few things for the "if event" part and all slow down
  779. >my code ALOT.  I'm doing about 20K calculations or more. (all floating pt)
  780. >Calculation time goes from ~10sec to ~20sec with event handling.
  781.  
  782. How about breaking the event handling into two pieces: when your app is in the
  783. foreground and when it's in the background.  In the foreground case, you'll
  784. probably want to run as fast as possible since the user's sitting there
  785. waiting.  In the background case, they're doing something else, so you can
  786. yield more time to the other apps they're probably playing with.
  787.  
  788. Replace the "if event" pseudocode with:
  789.  
  790. if (not in foreground) or (yieldTicks < TickCount) or (EventAvail()) {
  791.   do event
  792.   yieldTicks = TickCount() + HoldoffTicks
  793. }
  794.  
  795.  
  796. You need to initialize yieldTicks=0.  EventAvail() is a system routine that
  797. will check if there are any pending events.  This should allow you to quickly
  798. respond to events without yielding all the time, yet let other apps in once
  799. in awhile.  Note that I'm not sure if any process stuff has been patched into
  800. EventAvail for system 7.0, so you may still be hosed...
  801.  
  802. steve
  803. - -- 
  804. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  805.   Steve Christensen            Never hit a man with glasses.
  806.   stevec@apple.com            Hit him with a baseball bat.
  807.  
  808. +++++++++++++++++++++++++++
  809.  
  810. From: David.Swofford@macnet.omahug.org (David Swofford)
  811. Date: 13 Mar 92 04:48:06 GMT
  812. Organization: Macnet Omaha
  813.  
  814. (From: swofford@uxh.cso.uiuc.edu (David Swofford ))
  815. (Organization: University of Illinois at Urbana)
  816.  
  817. sgrenander@NASAMAIL.JPL.NASA.GOV (Sven Grenander) writes:
  818.  
  819. >In article <16rR02FT0dVj01@JUTS.ccc.amdahl.com>, rla20@duts.ccc.amdahl.com
  820. (Roger Allen) writes:
  821. >> 
  822. >> What is the best way to do some sort of calculation that will take some
  823. >> time WITHOUT making the calculation time much longer due to adding code
  824. >> ....
  825.  
  826. >The way I handle this is either of the following (depending on
  827. >how long the operation is likely to take):
  828.  
  829. >If it is a long operation which does not have to be finished
  830. >right away (write multi-meg files with sorting interspersed, or
  831. >some such thing) I simply post a chore (ThC CChore) to trigger
  832. >X executions every time through the event loop.
  833.  
  834. >If it is a higher priority, shorter duration activity I simply
  835. >put an EventAvail in the tight loops. If the EventAvail == TRUE
  836. >I save my current loop variables, post a chore to re-enter
  837. >the loop, exit out to the main event loop and pick back up
  838. >where I was in the loop when the chore fires again.
  839.  
  840. >This second method works very well for me, actually both do.
  841. >However, the second one lets me accept a 19.2 Kb serial feed,
  842. >with rather messy parsing, window updating and Object creation,
  843. >disposal etc while not impacting word processing, MacDrawing
  844. >or whatever. At least I can't type fast enough to outrun my fx.
  845.  
  846. This may have missed the point of the original poster's question 
  847. (apologies to Sven if I'm wrong).  My application also does
  848. heavy-duty computation for long periods, but I want to watch for 
  849. update, suspend/resume, etc. events (and most importantly, command-period
  850. keyboard events).  I suspect the original poster had the same thing
  851. in mind.  Calling GetNextEvent or WaitNextEvent from computation loops 
  852. can REALLY slow things down a lot.  I used to call EventAvail 
  853. (actually OSEventAvail, which is even faster) and didn't call 
  854. Get/WaitNextEvent unless I knew there was an event to deal with.  
  855. But this approach didn't work well with MultiFinder, so I decided
  856. on the following:
  857.  
  858. If you're in the FOREGROUND, call Get/WaitNextEvent only twice a second
  859. or so.  I just keep a 'lastEventCheckTime' after every such call and
  860. do an "if (Ticks - lastEventCheckTime > 30)" test before checking for
  861. events and processing them.  The worst that can happen is that there
  862. will be a slight delay (no more than 1/2 a second) after a user
  863. hits a command-period key (or whatever) until the event gets handled.
  864. I find that event-checking has little impact on the speed of the
  865. calculations as long as you limit it to this rate.  But if you're in
  866. the BACKGROUND, it's crucial to call GetNextEvent or (preferably)
  867. WaitNextEvent much more often, so that you won't slow the foreground
  868. application to a crawl (It doesn't do any good to allow background
  869. calculations if you impose a 1/2 sec delay on every keystroke on the
  870. foreground app). 
  871. - --
  872. David L. Swofford                 Phone:    (217)244-6959
  873. Illinois Natural History Survey   FAX:      (217)333-4949
  874. 607 E. Peabody Drive              BITNET:   DAVESWOF@UIUCVMD
  875. Champaign, Illinois 61820 USA     Internet: swofford@uxh.cso.uiuc.edu
  876.  
  877. - ---
  878.  * Origin: Interuniverse Gateway (ivgate), Omaha (11:30102/2.0)
  879. SEEN-BY: 285/1 285/14
  880.  
  881. +++++++++++++++++++++++++++
  882.  
  883. From: sundinKC@dna.lth.se (Anders Sundin)
  884. Date: 16 Mar 92 11:30:26 GMT
  885. Organization: Organic Chemistry 2, Lund University, Sweden
  886.  
  887. Roger Allen writes:
  888. >
  889. >   Psuedocode:
  890. >      bring up progress dialog box
  891. >      while not done do {
  892. >        do calculation and store value
  893. >        update dialog box
  894. >        if event (HELP this takes alot of time!)
  895. >          do event
  896. >      }
  897. >      bring down progress dialog box
  898. >
  899.  
  900. In my opinion one should call WaitNextEvent/GetNextEvent at least
  901. ten to twenty times per second. However, when the application is
  902. running in the foreground it is probably enough with two to five
  903. calls per second.
  904.  
  905. If you tune the loop to a Macintosh Quadra you will get very bad 
  906. interactivity on a Macintosh Plus. On the other hand, if you tune
  907. the loop to a Plus you will waste time on a Quadra.
  908.  
  909. If you want to run well on everything from a Macintosh Plus to a
  910. Quadra you will have to know the real time. You can get this
  911. by calling TickCount after each calculation step. Try to make one
  912. calculation step take about one tick on a Plus to avoid wasting
  913. time by calling TickCount too often.
  914. - -- 
  915.  Anders Sundin           e-mail: sundinKC@dna.lth.se
  916.  Organic Chemistry 2             Anders.Sundin@orgk2.lth.se
  917.  University of Lund              ok2aps@gemini.ldc.lu.se
  918.  P.O. Box 124                    ok2aps@seldc52.bitnet
  919.  S-22100 Lund            phone:  +46 46 108214
  920.  Sweden                  fax:    +46 46 108209
  921.  
  922. ---------------------------
  923.  
  924. From: petrus@stacken.kth.se (Lars Petrus)
  925. Subject: AppleLink <-> internet ?
  926. Date: 14 Mar 92 20:04:24 GMT
  927. Organization: Stacken Computer Club, Stockholm, Sweden
  928.  
  929.  
  930.    This may be a FAQ. It may even be the wrong newsgroup. But at least it's
  931. simple: 
  932.  
  933. How do you send email between here and AppleLink? 
  934. Is there any problem with such traffic?
  935.  
  936.  
  937. "Madness is the first sign of dandruff" |   Email:   petrus@alex.stacken.kth.se
  938.    - Dr Winston O'Boogie                |   Reality: Lars Petrus, Solna, Sweden
  939.  
  940. +++++++++++++++++++++++++++
  941.  
  942. From: d88-jwa@byse.nada.kth.se (Jon W{tte)
  943. Date: 14 Mar 92 22:28:53 GMT
  944. Organization: Royal Institute of Technology, Stockholm, Sweden
  945.  
  946. .se> petrus@stacken.kth.se (Lars Petrus) writes:
  947.  
  948.    How do you send email between here and AppleLink? 
  949.    Is there any problem with such traffic?
  950.  
  951.  
  952. Well, yes and no:
  953.  
  954. The problem is that the applelink account pays for both incoming
  955. and outgoing mail, I believe the charge is $0.50 per message
  956. through the gateway.
  957.  
  958. To mail to someone on AppleLink, for instance nordic ADT, you
  959. mail: NORDIC.ADT@AppleLink.Apple.com
  960.  
  961. I don't know what it looks like on the other side, but replying
  962. works.
  963.  
  964. - -- 
  965. This signature is placed into the Public Domain by Jon W{tte (h+@nada.kth.se)
  966.                      - The worlds only romantic cynic -
  967.  
  968. +++++++++++++++++++++++++++
  969.  
  970. From: kire@cyklop.nada.kth.se (Jan-Erik M}ngs)
  971. Date: 16 Mar 92 12:30:42 GMT
  972. Organization: Royal Institute of Technology, Stockholm, Sweden
  973.  
  974. In article <D88-JWA.92Mar14232853@byse.nada.kth.se> d88-jwa@byse.nada.kth.se (Jon W{tte) writes:
  975.  
  976.    .se> petrus@stacken.kth.se (Lars Petrus) writes:
  977.  
  978.       How do you send email between here and AppleLink? 
  979.  
  980.    To mail to someone on AppleLink, for instance nordic ADT, you
  981.    mail: NORDIC.ADT@AppleLink.Apple.com
  982.  
  983.    I don't know what it looks like on the other side, but replying
  984.    works.
  985.  
  986. While on AppleLink, send to: user@internet.host@INTERNET#
  987.                              kire@nada.kth.se@INTERNET#
  988.  
  989. ---------------------------
  990.  
  991. From: rkou@skat.usc.edu (Roger H. Kou)
  992. Subject: enum in Think C
  993. Date: 15 Mar 1992 11:40:02 -0800
  994. Organization: USC Computing Services, Los Angeles
  995.  
  996.  
  997. hi there,
  998.  
  999. I have been porting some codes from UNIX to MacOS, using Think C
  1000. 5.0.2(?) to compile. but I am having trouble w/enum stuff. Can't find
  1001. any ref. in the manual.
  1002.  
  1003. can someone please give me some insight to this?
  1004.  
  1005. thanks,
  1006.  
  1007. Roger...
  1008.  
  1009. +++++++++++++++++++++++++++
  1010.  
  1011. From: funakubo@sagagw.cc.saga-u.ac.jp (Koichi FUNAKUBO)
  1012. Date: 17 Mar 92 01:58:24 GMT
  1013. Organization: Information Processing Center, Saga University, Saga, Japan.
  1014.  
  1015.  
  1016.   Have you turn on the "enums are always ints" option in the
  1017.   Language Settiong page of the Options... dialog ?
  1018.  
  1019.   THINK C always makes an enum as small as possible or as large as
  1020.   necessary. So you need to turn the option on to port ANSI-conformant
  1021.   codes to THINK C.
  1022.   These are written on pp.176-177 of the user manual.
  1023. - --
  1024.                                            =================================
  1025.                                              Koichi Funakubo
  1026.                                              Department of Physics
  1027.                                              Saga University, Saga 840
  1028.                                              JAPAN
  1029.                                              funakubo@sagagw.cc.saga-u.ac.jp
  1030.                                            =================================
  1031.  
  1032. ---------------------------
  1033.  
  1034. From: michaelp@calvin.usc.edu (Michael Peterson)
  1035. Subject: Printer Info Stored Where?
  1036. Date: 15 Mar 1992 18:06:28 -0800
  1037. Organization: University of Southern California, Los Angeles, CA
  1038.  
  1039.  
  1040.  
  1041. Anyone know where the print info is stored in the system and what it means.
  1042. I interested in having some software that sets the print up without using the
  1043. chooser.
  1044.  
  1045.     Thanks.
  1046.     Michael L. Peterson
  1047.     michaelp@calvin.usc.edu
  1048.  
  1049. +++++++++++++++++++++++++++
  1050.  
  1051. From: bts39313@uxa.cso.uiuc.edu (Benjamin T Sander)
  1052. Organization: University of Illinois at Urbana
  1053. Date: Tue, 17 Mar 1992 15:31:00 GMT
  1054.  
  1055. michaelp@calvin.usc.edu (Michael Peterson) writes:
  1056.  
  1057.  
  1058.  
  1059. >Anyone know where the print info is stored in the system and what it means.
  1060. >I interested in having some software that sets the print up without using the
  1061. >chooser.
  1062.  
  1063. >    Thanks.
  1064. >    Michael L. Peterson
  1065. >     michaelp@calvin.usc.edu
  1066.  
  1067.  
  1068. Take a look at the 'STR ' resource with id -8192 in the System file.  This 
  1069. gives the name of the printer TYPE which is selected plus some other 
  1070. info.   
  1071.  
  1072. Also, the name of the printer which is currently selected ("ImageWriter 1" or
  1073. "ImageWriter II") is stored in the printer driver itself in a PAPA resource.
  1074.  
  1075. Ben
  1076. bts39313.uxa.uiuc.edu
  1077.  
  1078.  
  1079. ---------------------------
  1080.  
  1081. From: dedreb@arco.com (Richard Beecher)
  1082. Subject: Problem with FSpExchangeFiles
  1083. Date: 16 Mar 92 21:49:22 GMT
  1084. Organization: Arco Alaska, Inc.
  1085.  
  1086. I have implemented a "safe save" strategy in my code as suggested in IM VI
  1087. using the FSpExchangeFiles function.  Works like a charm, except that the
  1088. temporary file that is created in the process doesn't get deleted.  FSpDelete()
  1089. returns a file busy error (-47).  The end result is that the temporary file
  1090. ends up in the Trash after each restart/reboot.
  1091.  
  1092. Incidentally, I can delete the file BEFORE calling FSpExchangeFiles, which
  1093. makes me think that FSpExchangeFiles opens the data and/or resource forks, but
  1094. does not close them.  Am I right?  If so, what can I do to fix the problem? 
  1095. Any help would be much appreciated.  Please e-mail to me, and I'll post a
  1096. summary.
  1097.  
  1098.  
  1099. Richard Beecher
  1100. (dedreb@arco.com)
  1101.  
  1102.  
  1103. My code is given below (some portions removed for brevity).
  1104.  
  1105.  
  1106. /****************** SaveSettings *****************/
  1107.  
  1108. void SaveSettings()
  1109. {
  1110.    short        foundVRefNum;
  1111.    long         foundDirID;
  1112.    OSErr        err;
  1113.    FSSpec       tempFile;
  1114.    short        tempRefNum;
  1115.    Str255       tempFileName = { "\pFP Scrap" };
  1116.  
  1117.  
  1118.    /* Create a temporary file for the safe save */
  1119.  
  1120.    err = FindFolder( kOnSystemDisk, kTemporaryFolderType, kCreateFolder,
  1121.                    &foundVRefNum, &foundDirID );
  1122.    if ( err )
  1123.       ErrorString( "\pCould not find/create the Temporary Items Folder.",
  1124.       stopError );
  1125.    FSMakeFSSpec( foundVRefNum, foundDirID, tempFileName, &tempFile );
  1126.  
  1127.    FSpCreateResFile( &tempFile, 'trsh', 'trsh', smSystemScript );
  1128.    err = ResError();
  1129.    if ( err )
  1130.       ErrorString( "\pCouldn't create the temporary save file!", stopError );
  1131.  
  1132.    tempRefNum = FSpOpenResFile( &tempFile, fsRdWrPerm );
  1133.    err = ResError();
  1134.    if ( err != noErr )
  1135.       ErrorString( "\pCouldn't open the temporary save file!", stopError );
  1136.  
  1137.  
  1138.    /* Add the resources to the temporary file */
  1139.  
  1140.    UseResFile( tempRefNum );
  1141.    SaveResources();
  1142.    CloseResFile( tempRefNum );
  1143.  
  1144.  
  1145.    /* Now, exchange the files */
  1146.  
  1147.    /* err = FSpDelete( &tempFile );  <---- works fine here */
  1148.  
  1149.    /* Note:  settingsFile already exists */
  1150.  
  1151.    err = FSpExchangeFiles( &tempFile, &settingsFile );
  1152.    if ( err )
  1153.       ErrorString( "\pCouldn't finish the save operation!", stopError );
  1154.  
  1155.    err = FSpDelete( &tempFile );  /* returns a file busy error -47 */
  1156.    if ( err )
  1157.       ErrorString( "\pCouldn't delete the temporary file!", stopError );
  1158. }
  1159.  
  1160. +++++++++++++++++++++++++++
  1161.  
  1162. From: dedreb@arco.com (Richard Beecher)
  1163. Date: 17 Mar 92 17:01:18 GMT
  1164. Organization: Arco Alaska, Inc.
  1165.  
  1166. In article <1992Mar16.214922.4720@Arco.COM> I wrote:
  1167.  
  1168. >I have implemented a "safe save" strategy in my code as suggested in IM VI
  1169. >using the FSpExchangeFiles function.  Works like a charm, except that the
  1170. >temporary file that is created in the process doesn't get deleted. 
  1171. FSpDelete()
  1172. >returns a file busy error (-47).  The end result is that the temporary file
  1173. >ends up in the Trash after each restart/reboot.
  1174. >
  1175. >Incidentally, I can delete the file BEFORE calling FSpExchangeFiles, which
  1176. >makes me think that FSpExchangeFiles opens the data and/or resource forks, but
  1177. >does not close them.  Am I right?  If so, what can I do to fix the problem? 
  1178.  
  1179. As it turns out, I needed to close both the temporary file AND the settings
  1180. file before calling FSpExchangeFiles and FSpDelete, even though I was only
  1181. deleting the temporary file.  Many thanks to Jon Watte for the advice!
  1182.  
  1183. Richard Beecher (dedreb@arco.com)
  1184.  
  1185. ---------------------------
  1186.  
  1187. End of C.S.M.P. Digest
  1188. **********************
  1189.